<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>

    <table>
        <tr>
            <td>1</td>
            <td><input type="checkbox" name="xxxx"></td>
            <td>10</td>
        </tr>
        <tr>
            <td>2</td>
            <td><input type="checkbox" name="xxxx"></td>
            <td>20</td>
        </tr>
        <tr>
            <td>3</td>
            <td><input type="checkbox" name="xxxx"></td>
            <td>30</td>
        </tr>
        <tr>
            <td>4</td>
            <td><input type="checkbox" name="xxxx"></td>
            <td>40</td>
        </tr>
    </table>

<div>总数: <span id="total">0</span></div>

</body>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script>
    var total = 0;

    $("input[type=checkbox]").click(function(){

        var val = $(this).parent().next().text();

        if( $(this).is(":checked") ) {
            total += parseFloat(val);
        } else {
            total -= parseFloat(val);
        }

        $('#total').html(total);
    });
</script>
</html>
